//
//  InphaseProgress.m
//  ITV
//
//  Created by inphase on 17/5/4.
//  Copyright © 2017年 inphase. All rights reserved.
//

#import "InphaseProgress.h"
#import <SVProgressHUD.h>
#import <MBProgressHUD.h>

@implementation InphaseProgress

+(void)showError:(NSString *)error {
    
    [self showErrorInfor:error];
}

+(void)showWithError:(NSError *)error {

    if (error.code == -1009) {
        [self showError:@"网络连接失败,请检查您的网络"];
    }else {
    
        [self showError:error.localizedDescription];
    }
}

+(void) showErrorInfor:(NSString *) error{

    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:[UIApplication sharedApplication].keyWindow animated:YES];
    hud.mode = MBProgressHUDModeText;
    hud.label.text = error;
    hud.label.textColor = [UIColor whiteColor];
    hud.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
    hud.bezelView.color = [[UIColor blackColor] colorWithAlphaComponent:0.65];
    hud.margin = 8.0f;
    [hud hideAnimated:YES afterDelay:2];
}



@end
